﻿<%@ Page Title="Student Usage Report" Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true" CodeBehind="StudentUsageReport.aspx.cs" Inherits="AdministrationWeb.StudentUsageReport" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        function CheckDateEalier(sender, args) {
            if (sender._selectedDate < new Date()) {
                alert("You cannot select a day before today!");
                sender._selectedDate = new Date();
                // set the date back to the today
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
        }
        function DisplayDateToday(sender, args) {
            if (sender._selectedDate == null) {
                sender._selectedDate = new Date();
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headerText" runat="server">
    Student Usage Report
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table class="style1">
        <tr align="left">
            <td class="style2">
                Date Range:
            </td>
            <td class="style5">
                <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="format: mm/dd/yyyy" ControlToValidate="tbxStart" Display="Dynamic" ForeColor="Red"
                    Operator="DataTypeCheck" SetFocusOnError="True" Type="Date" Font-Size="8"></asp:CompareValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Start Date is a required Field" ControlToValidate="tbxStart" Display="Dynamic"
                    ForeColor="Red" Font-Size="8"></asp:RequiredFieldValidator>
            </td>
            <td class="style4">
                &nbsp;
            </td>
            <td>
                <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="format: mm/dd/yyyy" ControlToValidate="tbxEnd" Display="Dynamic" ForeColor="Red"
                    Operator="DataTypeCheck" SetFocusOnError="True" Type="Date" Font-Size="8"></asp:CompareValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="End Date is a required Field" ControlToValidate="tbxEnd" Display="Dynamic"
                    ForeColor="Red" Font-Size="8"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2" align="right">
                START
            </td>
            <td class="style5">
                <asp:TextBox runat="server" ID="tbxStart" />
                <AjaxToolkit:CalendarExtender runat="server" ID="Calendarextender2" TargetControlID="tbxStart" />
            </td>
            <td class="style4" align="right">
                END
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbxEnd" />
                <AjaxToolkit:CalendarExtender runat="server" ID="Calendarextender1" TargetControlID="tbxEnd" />
                <AjaxToolkit:ToolkitScriptManager runat="server" ID="ToolkitScriptManager2" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;
            </td>
            <td class="style5">
                <b />
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationConnectionString %>" ProviderName="<%$ ConnectionStrings:ApplicationConnectionString.ProviderName %>"
                    SelectCommand="SELECT username AS 'username', creation_date AS 'date created', last_name AS 'last name' FROM users LIMIT 0"></asp:SqlDataSource>
            </td>
            <td class="style4" align="right">
                <asp:Button ID="btnRun" runat="server" Text="RUN" OnClick="btnRun_Click" CssClass="button" />
            </td>
            <td>
                &nbsp;<asp:Button ID="btnExport" runat="server" Text="EXPORT" OnClick="btnExport_Click" CssClass="button" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                Group by:
            </td>
            <td class="style5">
                <asp:DropDownList ID="ddlGroupby" runat="server" AutoPostBack="True">
                    <asp:ListItem Value="1">ALL STUDENT ACTIVITY</asp:ListItem>
                    <asp:ListItem Value="2">STUDENT ACTIVITY BY YEAR</asp:ListItem>
                    <asp:ListItem Value="3">STUDENT MENTOR ACTIVITY</asp:ListItem>
                    <asp:ListItem Value="4">STUDENT PATHWAY ACTIVITY</asp:ListItem>
                    <asp:ListItem Value="5">STUDENT FOCUS ACTIVITY</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style4">
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;
            </td>
            <td class="style5">
                <asp:Label ID="lblYear" runat="server" Enabled="False" Text="Year:" Visible="False"></asp:Label>&nbsp;&nbsp;&nbsp;
                <asp:TextBox runat="server" ID="tbxYear" Enabled="False" Visible="False" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidatorYear" runat="server" ErrorMessage="required" ForeColor="Red" Font-Size="X-Small" ControlToValidate="tbxYear"
                    Display="Dynamic" Enabled="False"></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidatorYear" runat="server" ControlToValidate="tbxYear" Display="Dynamic" ErrorMessage="format: yyyy" ForeColor="Red" MaximumValue="9999"
                    MinimumValue="1000" SetFocusOnError="True" Type="Integer" Font-Size="X-Small"></asp:RangeValidator>
            </td>
            <td class="style4">
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;
            </td>
            <td class="style5">
                <asp:Label ID="lblUserId" runat="server" Enabled="False" Text="user id:" Visible="False"></asp:Label>&nbsp;
                <asp:TextBox ID="tbxUserId" runat="server" Enabled="False" Visible="False"></asp:TextBox>
                <br />
                <asp:Label ID="lblActionType" runat="server" Enabled="False" Text="action:" Visible="False"></asp:Label>&nbsp;&nbsp;
                <asp:DropDownList ID="ddlActionType" runat="server" Enabled="False" 
                    Visible="False" DataSourceID="SqlDataSource2" DataTextField="action_text" 
                    DataValueField="action_id">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ApplicationConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:ApplicationConnectionString.ProviderName %>" 
                    SelectCommand="SELECT action_id, action_text FROM lkup_mentor_student_logged_action">
                </asp:SqlDataSource>
            </td>
            <td class="style4">
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <p>
        <asp:GridView ID="GridViewReports" runat="server" CellPadding="4" 
            DataSourceID="SqlDataSource1" GridLines="None" ForeColor="#333333" ShowHeaderWhenEmpty="True"
            CellSpacing="3" HorizontalAlign="Left" Visible="False">
            <AlternatingRowStyle BackColor="White" />
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
            <HeaderStyle BackColor="#195126" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#A0E2AF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#D1F5BA" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D1F5BA" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
    </p>
</asp:Content>
